const getuserModel = require("../models/getuser_model")
const Result = require("../beans/result")
// 获取用户列表
function getuserlist(account, msg, callback) {

    getuserModel.getuser(account,(err, data) => {
        if (err) {
            callback(new Result(err, null, msg[0], 401))
        } else {
            callback(new Result(null, data, msg[1], 200))
        }
    })
}
function adduserlist(userObj, msg, callback) {

    getuserModel.adduser(userObj,(err, data) => {
        if (err) {
            callback(new Result(err, null, msg[0], 401))
        } else {
            callback(new Result(null, null, msg[1], 200))
        }
    })
}
function patchuserlist(userObj, msg, callback) {

    getuserModel.patchuser(userObj,(err, data) => {
        if (err) {
            callback(new Result(err, null, msg[0], 401))
        } else {
            callback(new Result(null, null, msg[1], 200))
        }
    })
}
function deleteuserlist(useraccount, msg, callback) {

    getuserModel.deleteuser(useraccount,(err, data) => {
        if (err) {
            callback(new Result(err, null, msg[0], 401))
        } else {
            callback(new Result(null, null, msg[1], 200))
        }
    })
}
module.exports={
    getuserlist,
    adduserlist,
    patchuserlist,
    deleteuserlist
}